<template>
	<view class="header">
		<view class="header_left">
			<rui-icons icon="side" size="40" @click="onSide"></rui-icons>
			<!-- 	<view class="header_left_number">
				2
			</view> -->
		</view>
		<!-- 		<view class="header_cneter">
			云上归属
		</view> -->
		<view class="header_right">
			<view class="header_right_item" @click="onClear">
				<rui-icons icon="addmsg" size="45"></rui-icons>
				<!-- <view class="header_right_item_number" v-if="chat.data.length">
					{{chat.data.length}}
				</view> -->
			</view>
			<view class="header_right_item" @click="$rui.route('/pages/user/message/message')">
				<rui-icons icon="msg" size="40"></rui-icons>
				<view class="header_right_item_number" v-if="user.msg">
					{{user.msg}}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		chatStore,
		userStore
	} from "@/store/index.js"
	
	const chat = chatStore();
	const user = userStore();
	
	const emits = defineEmits(['side']);
	const onSide = () => {
		emits('side');
	}

	const onClear = () => {
		chat.clear();
	}
</script>

<style lang="scss">
	.header {
		background: #f6f7f8;
		position: fixed;
		top: -2rpx;
		left: 0;
		width: calc(100% - 20rpx);
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10rpx;
		z-index: 99;

		&_left {
			position: relative;

			&_number {
				position: absolute;
				top: -10rpx;
				right: -25rpx;
				font-size: 20rpx;
				width: 35rpx;
				height: 35rpx;
				color: #fff;
				background: #f00;
				border-radius: 50%;
				text-align: center;
				line-height: 35rpx;
			}
		}

		&_right {
			display: flex;
			align-items: center;

			&_item {
				position: relative;
				margin: 10rpx 25rpx;

				&_number {
					position: absolute;
					top: -15rpx;
					right: -15rpx;
					font-size: 20rpx;
					width: 35rpx;
					height: 35rpx;
					color: #fff;
					background: #f00;
					border-radius: 50%;
					text-align: center;
					line-height: 35rpx;
				}
			}
		}
	}
</style>